/*
 * Alloy Analyzer
 * Copyright (c) 2002 Massachusetts Institute of Technology
 *
 * The Alloy Analyzer is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * The Alloy Analyzer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with the Alloy Analyzer; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package alloy.ast;


/** Visitor which traverses the AST depth-first. */

public class ASTDepthFirstVisitor implements ASTVisitor {

    /**
     * Traverse a node's children depth-first.
     */
    public void visit(Node node_) {
        /*Iterator children = node_.getChildren();
        while (children.hasNext()) {
            ((Node)children.next()).applyVisitor(this);
        }*/
    int numChildren = node_.numChildren();
    for (int i = 0; i < numChildren; i++) {
        node_.childAt(i).applyVisitor(this);
    }
    }

    /** Visit a node of type {@link LeafExpr}. */
    public void visit(LeafExpr leafExpr_) {
        visit((TypedExpr)leafExpr_);
    }

    /** Visit a node of type {@link ArgList}
     *  and traverse its children depth first*/
    public void visit(ArgList argList_){
        visit((Node)argList_);
    }

    /** Visit a node of type {@link SumIntExpr}
     *  and traverse its children depth first*/
    public void visit(SumIntExpr sumIntExpr_){
        visit((Node)sumIntExpr_);
    }

    /** Visit a node of type {@link ArrowMultExpr}
     *  and traverse its children depth first*/
    public void visit(ArrowMultExpr arrowMultExpr_){
        visit((Node)arrowMultExpr_);
    }

    /** Visit a node of type {@link Assertion}
     *  and traverse its children depth first*/
    public void visit(Assertion assertion_){
        visit((FormulaPara)assertion_);
    }

    /** Visit a node of type {@link Assertions}
     *  and traverse its children depth first*/
    public void visit(Assertions assertions_){
        visit((Node)assertions_);
    }

    /** Visit a node of type {@link BinaryExpr}
     *  and traverse its children depth first*/
    public void visit(BinaryExpr binaryExpr_){
        visit((TypedExpr)binaryExpr_);
    }

    public void visit(Op op_) { visit((Node)op_); }

    /** Visit a node of type {@link BinaryExprOp}
     *  and traverse its children depth first*/
    public void visit(BinaryExprOp binaryExprOp_){
        visit((Op)binaryExprOp_);
    }

    /** Visit a node of type {@link BinaryFormula}
     *  and traverse its children depth first*/
    public void visit(BinaryFormula binaryFormula_){
        visit((AbstractFormula)binaryFormula_);
    }

    /** Visit a node of type {@link CardinalityExpr}
     *  and traverse its children depth first*/
    public void visit(CardinalityExpr cardinalityExpr_){
        visit((Node)cardinalityExpr_);
    }

    /** Visit a node of type {@link CheckCommand}
     *  and traverse its children depth first*/
    public void visit(CheckCommand checkCommand_){
        visit((FindCommand)checkCommand_);
    }

    /** Visit a node of type {@link Command}
     *  and traverse its children depth first*/
    public void visit(Command command_){
        visit((Node)command_);
    }

    /** Visit a node of type {@link Commands}
     *  and traverse its children depth first*/
    public void visit(Commands commands_){
        visit((Node)commands_);
    }

    /** Visit a node of type {@link CompOp}
     *  and traverse its children depth first*/
    public void visit(CompOp compOp_){
        visit((Op)compOp_);
    }

    /** Visit a node of type {@link ComprehensionExpr}
     *  and traverse its children depth first*/
    public void visit(ComprehensionExpr comprehensionExpr_){
        visit((TypedExpr)comprehensionExpr_);
    }

    /** Visit a node of type {@link DeclFormula}
     *  and traverse its children depth first*/
    public void visit(DeclFormula declFormula_){
        visit((AbstractFormula)declFormula_);
    }

    /** Visit a node of type {@link Decl}
     *  and traverse its children depth first*/
    public void visit(Decl decl_){
        visit((Node)decl_);
    }

    /** Visit a node of type {@link Decls}
     *  and traverse its children depth first*/
    public void visit(Decls decls_){
        visit((Node)decls_);
    }

    /** Visit a node of type {@link ElemFormula}
     *  and traverse its children depth first*/
    public void visit(ElemFormula elemFormula_){
        visit((AbstractFormula)elemFormula_);
    }

    /** Visit a node of type {@link EmptySetExpr}
     *  and traverse its children depth first*/
    public void visit(EmptySetExpr emptySetExpr_){
        visit((GenericConstExpr)emptySetExpr_);
    }


    /** Visit a node of type {@link Expr}
     *  and traverse its children depth first*/
    public void visit(Expr expr_){
        visit((Node)expr_);
    }

    /** Visit a node of type {@link Exprs}
     *  and traverse its children depth first*/
    public void visit(Exprs exprs_){
        visit((Node)exprs_);
    }

    /** Visit a node of type {@link Fact}
     *  and traverse its children depth first*/
    public void visit(Fact fact_){
        visit((FormulaPara)fact_);
    }

    /** Visit a node of type {@link FindCommand}
     *  and traverse its children depth first*/
    public void visit(FindCommand findCommand_){
        visit((Command)findCommand_);
    }

    /** Visit a node of type {@link Formula}
     *  and traverse its children depth first*/
    public void visit(Formula formula_){
        visit((Node)formula_);
    }

    /** Visit a node of type {@link FormulaPara}
     *  and traverse its children depth first*/
    public void visit(FormulaPara formulaPara_){
        visit((Node)formulaPara_);
    }

    /** Visit a node of type {@link FormulaSeq}
     *  and traverse its children depth first*/
    public void visit(FormulaSeq formulaSeq_){
        visit((AbstractFormula)formulaSeq_);
    }

    /** Visit a node of type {@link Formulas}
     *  and traverse its children depth first*/
    public void visit(Formulas formulas_){
        visit((Node)formulas_);
    }

    /** Visit a node of type {@link Function}
     *  and traverse its children depth first*/
    public void visit(Function function_){
        visit((InvocablePara)function_);
    }

    /** Visit a node of type {@link Functions}
     *  and traverse its children depth first*/
    public void visit(Functions functions_){
        visit((Node)functions_);
    }

    /** Visit a node of type {@link GeneralScope}
     *  and traverse its children depth first*/
    public void visit(GeneralScope generalScope_){
        visit((Node)generalScope_);
    }

    /** Visit a node of type {@link Id}
     *  and traverse its children depth first*/
    public void visit(Id id_){
        visit((Node)id_);
    }

    /** Visit a node of type {@link Ids}
     *  and traverse its children depth first*/
    public void visit(Ids ids_){
        visit((Node)ids_);
    }

    /** Visit a node of type {@link ImplicationFormula}
     *  and traverse its children depth first*/
    public void visit(ImplicationFormula implicationFormula_){
        visit((AbstractFormula)implicationFormula_);
    }

    /** Visit a node of type {@link InvocationExpr}
     *  and traverse its children depth first*/
    public void visit(InvocationExpr invocationExpr_){
        visit((TypedExpr)invocationExpr_);
    }

    /** Visit a node of type {@link InvocationFormula}
     *  and traverse its children depth first*/
    public void visit(InvocationFormula invocationFormula_){
        visit((AbstractFormula)invocationFormula_);
    }

    /** Visit a node of type {@link SumExpr}
     *  and traverse its children depth first*/
    public void visit(SumExpr sumExpr_){
        visit((Node)sumExpr_);
    }

    /** Visit a node of type {@link LogicOp}
     *  and traverse its children depth first*/
    public void visit(LogicOp logicOp_){
        visit((Op)logicOp_);
    }

    /** Visit a node of type {@link Module}
     *  and traverse its children depth first*/
    public void visit(Module module_){
        visit((Node)module_);
    }

    /** Visit a node of type {@link Modules}
     *  and traverse its children depth first*/
    public void visit(Modules modules_){
        visit((Node)modules_);
    }

    /** Visit a node of type {@link MultiplicityExpr}
     *  and traverse its children depth first*/
    public void visit(MultiplicityExpr multiplicityExpr_){
        visit((Node)multiplicityExpr_);
    }

    /** Visit a node of type {@link MultiplicityFormula} **/
    public void visit(MultiplicityFormula multFormula_) {
	visit((Node)multFormula_);
    }


    /** Visit a node of type {@link NegFormula}
     *  and traverse its children depth first*/
    public void visit(NegFormula negFormula_){
        visit((AbstractFormula)negFormula_);
    }

    /** Visit a node of type {@link Path}
     *  and traverse its children depth first*/
    public void visit(Path path_){
        visit((Node)path_);
    }

    /** Visit a node of type {@link Predicate}
     *  and traverse its children depth first*/
    public void visit(Predicate predicate_){
        visit((InvocablePara)predicate_);
    }

    /** Visit a node of type {@link Predicates}
     *  and traverse its children depth first*/
    public void visit(Predicates predicates_){
        visit((Node)predicates_);
    }

    /** Visit a node of type {@link Qualifier}
     *  and traverse its children depth first*/
    public void visit(Qualifier qualifier_){
        visit((Node)qualifier_);
    }

    /** Visit a node of type {@link Qualifiers}
     *  and traverse its children depth first*/
    public void visit(Qualifiers qualifiers_){
        visit((Node)qualifiers_);
    }

    /** Visit a node of type {@link QuantifiedExpr}
     *  and traverse its children depth first*/
    public void visit(QuantifiedExpr quantifiedExpr_){
        visit((AbstractFormula)quantifiedExpr_);
    }

    /** Visit a node of type {@link QuantifiedFormula}
     *  and traverse its children depth first*/
    public void visit(QuantifiedFormula quantifiedFormula_){
        visit((AbstractFormula)quantifiedFormula_);
    }

    /** Visit a node of type {@link Quantifier}
     *  and traverse its children depth first*/
    public void visit(Quantifier quantifier_){
        visit((Op)quantifier_);
    }

   
    /** Visit a node of type {@link RunCommand}
     *  and traverse its children depth first*/
    public void visit(RunCommand runCommand_){
        visit((FindCommand)runCommand_);
    }

    /** Visit a node of type {@link Scope}
     *  and traverse its children depth first*/
    public void visit(Scope scope_){
        visit((Node)scope_);
    }

    /** Visit a node of type {@link SetMultExpr}
     *  and traverse its children depth first*/
    public void visit(SetMultExpr setMultExpr_){
        visit((Node)setMultExpr_);
    }

    /** Visit a node of type {@link Multiplicity}
     *  and traverse its children depth first*/
    public void visit(Multiplicity multiplicity_){
        visit((Node)multiplicity_);
    }

    /** Visit a node of type {@link SigExpr}
     *  and traverse its children depth first*/
    public void visit(SigExpr sigExpr_){
        visit((LeafExpr)sigExpr_);
    }

    /** Visit a node of type {@link SigExprs}
     *  and traverse its children depth first*/
    public void visit(SigExprs sigExprs_){
        visit((Node)sigExprs_);
    }

    /** Visit a node of type {@link Signature}
     *  and traverse its children depth first*/
    public void visit(Signature signature_){
        visit((Node)signature_);
    }

    /** Visit a node of type {@link Signatures}
     *  and traverse its children depth first*/
    public void visit(Signatures signatures_){
        visit((Node)signatures_);
    }

    /** Visit a node of type {@link Specification}
     *  and traverse its children depth first*/
    public void visit(Specification specification_){
        visit((Node)specification_);
    }

    /** Visit a node of type {@link SpecificScope}
     *  and traverse its children depth first*/
    public void visit(SpecificScope specificScope_){
        visit((Node)specificScope_);
    }


    /** Visit a node of type {@link TreeNode}
     *  and traverse its children depth first*/
    public void visit(TreeNode treeNode_){
        visit((Node)treeNode_);
    }

    /** Visit a node of type {@link TypeScope}
     *  and traverse its children depth first*/
    public void visit(TypeScope typeScope_){
        visit((Node)typeScope_);
    }

    /** Visit a node of type {@link TypeScopes}
     *  and traverse its children depth first*/
    public void visit(TypeScopes typeScopes_){
        visit((Node)typeScopes_);
    }

    /** Visit a node of type {@link UnaryExpr}
     *  and traverse its children depth first*/
    public void visit(UnaryExpr unaryExpr_){
        visit((TypedExpr)unaryExpr_);
    }

    /** Visit a node of type {@link UnaryExprOp}
     *  and traverse its children depth first*/
    public void visit(UnaryExprOp unaryExprOp_){
        visit((Op)unaryExprOp_);
    }

    /** Visit a node of type {@link VariableExpr}
     *  and traverse its children depth first*/
    public void visit(VariableExpr variableExpr_){
        visit((LeafExpr)variableExpr_);
    }

    /** Visit a node of type {@link Variable}
     *  and traverse its children depth first*/
    public void visit(Variable variable_){
        visit((Node)variable_);
    }

    /** Visit a node of type {@link Variables}
     *  and traverse its children depth first*/
    public void visit(Variables variables_){
        visit((Node)variables_);
    }


    /** Visit a node of type {@link TypedExpr}
     *  and traverse its children depth first*/
    public void visit(TypedExpr typedExpr_){
        visit((Node)typedExpr_);
    }

    /** Visit a node of type {@link IntExpr}
     *  and traverse its children depth first*/
    public void visit(IntExpr intExpr_){
        visit((Node)intExpr_);
    }

    /** Visit a node of type {@link Facts}
     *  and traverse its children depth first*/
    public void visit(Facts facts_){
        visit((Node)facts_);
    }

    /** Visit a node of type {@link BinaryIntExpr}
     *  and traverse its children depth first*/
    public void visit(BinaryIntExpr binaryIntExpr_){
        visit((Node)binaryIntExpr_);
    }

    /** Visit a node of type {@link IntCompOp}
     *  and traverse its children depth first*/
    public void visit(IntCompOp intCompOp_){
        visit((Op)intCompOp_);
    }

    /** Visit a node of type {@link IntExprOp}
     *  and traverse its children depth first*/
    public void visit(IntExprOp intExprOp_){
        visit((Op)intExprOp_);
    }

    /** Visit a node of type {@link EmptyFormula}
     *  and traverse its children depth first*/
    public void visit(EmptyFormula emptyFormula_){
        visit((Node)emptyFormula_);
    }

    /** Visit a node of type {@link IntNode}
     *  and traverse its children depth first*/
    public void visit(IntNode intNode_){
        visit((Node)intNode_);
    }

    /** Visit a node of type {@link EmptyExpr}
     *  and traverse its children depth first*/
    public void visit(EmptyExpr emptyExpr_){
        visit((TypedExpr)emptyExpr_);
    }

    /** Visit a node of type {@link QualifiedName}
     *  and traverse its children depth first*/
    public void visit(QualifiedName qualifiedName_){
        visit((Node)qualifiedName_);
    }

    /** Visit a node of type {@link LiteralIntExpr}
     *  and traverse its children depth first*/
    public void visit(LiteralIntExpr literalIntExpr_){
        visit((Node)literalIntExpr_);
    }

    /** Visit a node of type {@link ElemIntFormula}
     *  and traverse its children depth first*/
    public void visit(ElemIntFormula elemIntFormula_){
        visit((Node)elemIntFormula_);
    }

    /** Visit a node of type {@link Paragraph}
     *  and traverse its children depth first*/
    public void visit(Paragraph paragraph_){
        visit((Node)paragraph_);
    }

    /** Visit a node of type {@link Paragraphs}
     *  and traverse its children depth first*/
    public void visit(Paragraphs paragraphs_){
        visit((Node)paragraphs_);
    }


    /** Visit a node of type {@link IntExprCastExpr} */
    public void visit(IntExprCastExpr intExprCastExpr_) {
        visit((TypedExpr)intExprCastExpr_);
    }

    /** Visit a node of type {@link ExprCastIntExpr} */
    public void visit(ExprCastIntExpr exprCastIntExpr_) {
        visit((Node)exprCastIntExpr_);
    }

    /** Visit a node of type {@link GenericConstExpr} */
    public void visit(GenericConstExpr genericConstExpr_) {
        visit((LeafExpr)genericConstExpr_);
    }

    /** Visit a node of type {@link UniversalExpr} */
    public void visit(UniversalExpr universalExpr_) {
        visit((GenericConstExpr)universalExpr_);
    }

    /** Visit a node of type {@link IdentityExpr} */
    public void visit(IdentityExpr identityExpr_) {
        visit((GenericConstExpr)identityExpr_);
    }
    /** Visit a node of type {@link IfThenElseExpr} */
    public void visit(IfThenElseExpr ifThenElseExpr_) {
        visit((TypedExpr)ifThenElseExpr_);
    }

    /** Visit a node of type {@link IfThenElseIntExpr} */
    public void visit(IfThenElseIntExpr ifThenElseIntExpr_) {
        visit((Node)ifThenElseIntExpr_);
    }

    /** Visit a node of type {@link LetDecl} */
    public void visit(LetDecl letDecl_) {
        visit((Node)letDecl_);
    }

    /** Visit a node of type {@link LetDecls} */
    public void visit(LetDecls letDecls_) {
        visit((Node)letDecls_);
    }

    /** Visit a node of type {@link LetImpl} */
    public void visit(LetImpl letImpl_) {
        visit((Node)letImpl_);
    }

    /** Visit a node of type {@link LetExpr} */
    public void visit(LetExpr letExpr_) {
        visit((LetImpl)letExpr_);
    }

    /** Visit a node of type {@link LetFormula} */
    public void visit(LetFormula letFormula_) {
        visit((AbstractFormula)letFormula_);
    }

    /** Visit a node of type {@link LetIntExpr} */
    public void visit(LetIntExpr letIntExpr_) {
        visit((LetImpl)letIntExpr_);
    }

    /** Visit a node of type {@link LetIntExpr} */
    public void visit(AbstractFormula abstractForm_) {
        visit((Node)abstractForm_);
    }

    /** Visit a node of type {@link SigmaExpr} */
    public void visit(SigmaExpr sigmaExpr_) {
        visit((Node)sigmaExpr_);
    }
}
